﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog.Master" AutoEventWireup="true"
    CodeBehind="UserSearchPopup.aspx.cs" Inherits="NetDon.OA.Portal.Components.UserSearchPopup" %>

<%@ Import Namespace="NetDon.OA.Interface" %>
<%@ Import Namespace="NetDon.Utilities" %>
<%@ Register Src="../Controls/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<%@ Register Src="Organization.ascx" TagName="OrganizationTree" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        function SelectAll(evtObj) {
            Array.forEach($array($get('<%=gridUsers.ClientID %>').getElementsByTagName("input")), function (elt) {

                if (elt.type == "checkbox" && elt.disabled == false) {
                    elt.checked = evtObj.checked;
                }
            })
        }
        function SendSelected(evtObj) {
            var count = 0;
            Array.forEach($array($get('<%=gridUsers.ClientID %>').getElementsByTagName("input")), function (elt) {
                if (elt.type == "checkbox" && elt.id != 'checkAll' && elt.checked) {
                    count++;
                }
            });
            if (count == 0) {
                $alert("Please select at least one product.");
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel runat="server" DefaultButton="btnSave" ID="Panel1" style="overflow: hidden">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top">
                    <uc1:OrganizationTree runat="server" ID="treeOrganization" />
                </td>
                <td valign="top">
                    <asp:Panel ID="Panel2" runat="server" DefaultButton="btnSearch">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <NetDon:FormPanel ID="FormPanel1" runat="server" RepeatColumns="2">
                                        <Items>
                                            <NetDon:FormItem HeaderText="用户名">
                                                <ContentTemplate>
                                                    <asp:TextBox ID="txtLoginName" runat="server" Width="125px"></asp:TextBox>
                                                </ContentTemplate>
                                            </NetDon:FormItem>
                                            <NetDon:FormItem HeaderText="Email">
                                                <ContentTemplate>
                                                    <asp:TextBox ID="txtEmail" runat="server" Width="125px"></asp:TextBox>
                                                </ContentTemplate>
                                            </NetDon:FormItem>
                                            <NetDon:FormItem HeaderText="姓名">
                                                <ContentTemplate>
                                                    <asp:TextBox ID="txtFullName" runat="server" Width="125px"></asp:TextBox>
                                                </ContentTemplate>
                                            </NetDon:FormItem>
                                            <NetDon:FormItem HeaderText="用户类型">
                                                <ContentTemplate>
                                                    <asp:DropDownList ID="dplUserType" runat="server" DataSourceID="EnumDataSourceUserType"
                                                        DataTextField="Description" DataValueField="Name" Width="125px">
                                                    </asp:DropDownList>
                                                    <NetDon:EnumDataSource ID="EnumDataSourceUserType" runat="server" EmptyItemType="All"
                                                        TypeName="NetDon.OA.Interface.UserType">
                                                    </NetDon:EnumDataSource>
                                                </ContentTemplate>
                                            </NetDon:FormItem>
                                            <NetDon:FormItem HeaderText="状态" ColumnSpan="2">
                                                <ContentTemplate>
                                                    <asp:DropDownList ID="dplUserStatus" runat="server" DataSourceID="EnumDataSourceUserStatus"
                                                        DataTextField="Description" DataValueField="Name" Width="125px">
                                                    </asp:DropDownList>
                                                    <NetDon:EnumDataSource ID="EnumDataSourceUserStatus" runat="server" EmptyItemType="All"
                                                        TypeName="NetDon.OA.Interface.UserStatus">
                                                    </NetDon:EnumDataSource>
                                                </ContentTemplate>  
                                            </NetDon:FormItem>
                                        </Items>
                                    </NetDon:FormPanel>
                                </td>
                                <td valign="bottom">
                                    <asp:Button ID="btnSearch" runat="server" Text="查询" SkinID="Button80" OnClick="btnSearch_Click" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <div style="margin-top: 10px">
                        <NetDon:GridView ID="gridUsers" runat="server" DataKeyNames="UserId" AllowSorting="true"
                            OnRowDataBound="gridUsers_RowDataBound">
                            <Columns>
                                <NetDon:TemplateField>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkSelectAll" runat="server" onclick="SelectAll(this)" />
                                    </HeaderTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkSelect" runat="server" />
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                                <NetDon:TemplateField>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:RadioButton runat="server" ID="radioSelected" GroupName="templateGroup" OnCheckedChanged="radioSelected_CheckedChanged"
                                            AutoPostBack="true" />
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                                <NetDon:BoundField HeaderText="用户名" SortExpression="UserName" DataField="UserName">
                                </NetDon:BoundField>
                                <NetDon:TemplateField HeaderText="姓名" SortExpression="FullName">
                                    <ItemTemplate>
                                        <%#Server.HtmlEncode(Convert.ToString(Eval("FullName")))%>
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                                <NetDon:TemplateField HeaderText="别名" SortExpression="NickName">
                                    <ItemTemplate>
                                        <%#Server.HtmlEncode(Convert.ToString(Eval("NickName")))%>
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                                <NetDon:BoundField HeaderText="Email" SortExpression="Email" DataField="Email">
                                </NetDon:BoundField>
                                <NetDon:TemplateField HeaderText="用户类型" SortExpression="Type">
                                    <ItemTemplate>
                                        <%#Server.HtmlEncode(EnumUtilities.GetDescription((UserType)Convert.ToInt32(Eval("Type"))))%>
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                                <NetDon:TemplateField HeaderText="状态" SortExpression="UserStatus">
                                    <ItemTemplate>
                                        <%#Server.HtmlEncode(EnumUtilities.GetDescription((UserStatus)Convert.ToInt32(Eval("UserStatus"))))%>
                                    </ItemTemplate>
                                </NetDon:TemplateField>
                            </Columns>
                        </NetDon:GridView>
                        <uc1:GridPager ID="PagerUsers" runat="server" TargetControlID="gridUsers" PageSize="10"
                            OnPerformGetCondition="PagerUsers_PerformGetCondition" OnPerformGetRecordCount="PagerUsers_PerformGetRecordCount"
                            OnPerformGetPageData="PagerUsers_PerformGetPageData" />
                    </div>
                    <div style="margin-top: 10px; text-align: center;">
                        <asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List"
                            ShowMessageBox="True" ShowSummary="False" />
                        <asp:Button ID="btnModify" runat="server" OnClick="btnModify_Click" Style="display: none"
                            CausesValidation="False" />
                        <asp:Button ID="btnReload" runat="server" OnClick="btnReload_Click" Style="display: none"
                            CausesValidation="False" />
                        <asp:Button ID="btnSave" runat="server" Text="选择" OnClick="btnChoose_Click" Style="margin-right: 5px">
                        </asp:Button>
                        <asp:Button ID="btnCancel" runat="server" Text="取消" CausesValidation="false" SkinID="Button60"
                            Style="margin-left: 5px"></asp:Button>
                    </div>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
